import {CHAMGE_INPUT_VALUE,DELECTE_ITEM,ADD_ITEM,INIT_DATA_INFO} from './actionType';
import axios from 'axios';
export const changeInputValue = (value)=>{
    return {
        type:CHAMGE_INPUT_VALUE,
        value
    }
}
export const delecteItem = (value)=>{
    return {
        type:DELECTE_ITEM,
        value
    }
}
export const addItem = (value)=>{
    return {
        type:ADD_ITEM,
        value
    }
}
const getInitDataInfo = (value)=>{
    return{
        type:INIT_DATA_INFO,
        value
    }
}
export const getInitData= ()=>{
    return (dispatch)=>{
        axios.get('/api/list').then((res)=>{
           const data = res.data;
           console.log(res)
           const antion =getInitDataInfo(data)
           dispatch(antion)
        })
    }
}